package gui;

import java.awt.ComponentOrientation;
import java.awt.Container;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class MoviesWindow {

	public final static boolean RIGHT_TO_LEFT = false;

	public static void addComponentsToPane(Container contentPane) {
		if (RIGHT_TO_LEFT) {
			contentPane
					.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
		}
		// Any number of rows and 2 columns
		contentPane.setLayout(new GridLayout(3, 0));
		
		contentPane.add(addComponentsToMovieLine( 3, "Black diamond"));
		contentPane.add(addComponentsToMovieLine( 4, "Red diamond"));
		contentPane.add(addComponentsToMovieLine( 1, "White diamond"));
	}

	private static JComboBox ratingBox(){
		JComboBox box = new JComboBox();
		box.addItem("1 star");
		box.addItem("2 stars");
		box.addItem("3 stars");
		box.addItem("4 stars");
		box.addItem("5 stars");
		return box;
	}
	public static JPanel addComponentsToMovieLine(
			int prediction, String movieName) {
		JPanel panel=new JPanel();
		panel.setLayout(new GridLayout(1, 0));
		JLabel pred = new JLabel(prediction + " stars");
		
		JLabel name = new JLabel(movieName);
		panel.add(pred);
		panel.add(ratingBox());
		panel.add(name);
		return panel;
	}

	private static void createAndShowGUI() {

		JFrame frame = new JFrame("Movies Ratings");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		// Set up the content pane and components in GridLayout
		addComponentsToPane(frame.getContentPane());

		frame.pack();
		frame.setVisible(true);
	}

	public static void main(String[] args) {
		javax.swing.SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				createAndShowGUI();
			}
		});
	}

}
